package com.h2cloud.depends;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: wulongkai
 * @create: 2022-10-10 14:58
 **/
@NoArgsConstructor
@AllArgsConstructor
@Data
public final class Response<T> {

    private Boolean success;
    private String msg;
    private T data;

    public static <T> Response<T> getSuccessResult() {
        return new Response<>(true, "success", null);
    }

    public static <T> Response<T> getSuccessResult(T data) {
        return new Response<>(true, "success", data);
    }

    public static <T> Response<T> getFailureResult(String msg) {
        return new Response<>(false, msg, null);
    }

    public static <T> Response<T> getFailureResult(String msg, T data) {
        return new Response<>(false, msg, data);
    }
}

